home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Source.bin / HorizontalLineBeanInfo.java < prev    next >
Text File  |  1998-08-21  |  3KB  |  101 lines

  1. package symantec.itools.awt.shape;
  2.  
  3. import java.beans.*;
  4. import symantec.itools.beans.*;
  5. import java.util.ResourceBundle;
  6.  
  7. //  09/07/97    LAB    Removed fillMode and fillColor as properties (Addresses Mac Bug #7687).
  8. //  08/19/98    LAB    Removed from ToolBar.
  9.  
  10. /**
  11.  * BeanInfo for HorizontalLine.
  12.  *
  13.  */
  14. public class HorizontalLineBeanInfo extends SimpleBeanInfo {
  15.  
  16.     /**
  17.      * Constructs a HorizontalLineBeanInfo object.
  18.      */
  19.     public HorizontalLineBeanInfo() {
  20.     }
  21.  
  22.     /**
  23.      * Gets a BeanInfo for the superclass of this bean.
  24.      * @return BeanInfo[] containing this bean's superclass BeanInfo
  25.      */
  26.     public BeanInfo[] getAdditionalBeanInfo() {
  27.         try {
  28.             BeanInfo[] bi = new BeanInfo[1];
  29.             bi[0] = Introspector.getBeanInfo(beanClass.getSuperclass());
  30.             return bi;
  31.         }
  32.         catch (IntrospectionException e) { throw new Error(e.toString());}
  33.     }
  34.  
  35.     /**
  36.      * Gets the SymantecBeanDescriptor for this bean.
  37.      * @return an object of type SymantecBeanDescriptor
  38.      * @see symantec.itools.beans.SymantecBeanDescriptor
  39.      */
  40.     public BeanDescriptor getBeanDescriptor() {
  41.         ResourceBundle group = ResourceBundle.getBundle("symantec.itools.resources.GroupBundle");
  42.         String s=group.getString("GroupShape"); 
  43.  
  44.         SymantecBeanDescriptor bd = new SymantecBeanDescriptor(beanClass);
  45.         bd.setFolder(s);
  46.  
  47.         bd.addAdditionalConnections(getAdditionalBeanInfo());
  48.  
  49.         return (BeanDescriptor) bd;
  50.     }
  51.  
  52.     /**
  53.      * Gets an image that may be used to visually represent this bean
  54.      * (in the toolbar, on a form, etc).
  55.      * @param iconKind the type of icon desired, one of: BeanInfo.ICON_MONO_16x16,
  56.      * BeanInfo.ICON_COLOR_16x16, BeanInfo.ICON_MONO_32x32, or BeanInfo.ICON_COLOR_32x32.
  57.      * @return an image for this bean, always color even if requested monochrome
  58.      * @see BeanInfo#ICON_MONO_16x16
  59.      * @see BeanInfo#ICON_COLOR_16x16
  60.      * @see BeanInfo#ICON_MONO_32x32
  61.      * @see BeanInfo#ICON_COLOR_32x32
  62.      */
  63.     public java.awt.Image getIcon(int iconKind) {
  64.         if (iconKind == BeanInfo.ICON_MONO_16x16 ||
  65.             iconKind == BeanInfo.ICON_COLOR_16x16) {
  66.             java.awt.Image img = loadImage("HorizontalLineC16.gif");
  67.             return img;
  68.         }
  69.  
  70.         if (iconKind == BeanInfo.ICON_MONO_32x32 ||
  71.             iconKind == BeanInfo.ICON_COLOR_32x32) {
  72.             java.awt.Image img = loadImage("HorizontalLineC32.gif");
  73.             return img;
  74.         }
  75.  
  76.         return null;
  77.     }
  78.  
  79.     /**
  80.      * Returns descriptions of this bean's properties.
  81.      */
  82.     public PropertyDescriptor[] getPropertyDescriptors() {
  83.         try{
  84.             
  85.         PropertyDescriptor fillColor = new PropertyDescriptor("fillColor", beanClass);
  86.         fillColor.setHidden(true);
  87.  
  88.         PropertyDescriptor fillMode = new PropertyDescriptor("fillMode", beanClass);
  89.         fillMode.setHidden(true);
  90.  
  91.         PropertyDescriptor[] rv = {
  92.             fillColor,
  93.             fillMode};
  94.  
  95.         return rv;
  96.         } catch (IntrospectionException e) { throw new Error(e.toString()); }
  97.     }
  98.  
  99.     private final static Class beanClass = HorizontalLine.class;
  100.  
  101.     }    //  end of class HorizontalLineBeanInfo